package sysu.el.audit;

/*
 * Easy to use.
 */
public class AuditFlt {
	public float min, max; 
	public int num;
	public double sum;
	public AuditFlt(){
		min = Float.MAX_VALUE;
		max = Float.MIN_VALUE;
	}
	public void sample(float value){
		min = Math.min(value, min);
		max = Math.max(value, max);
		sum += value;
		num ++;
	}
	
	public void sample(float[] values){
		for (float e:values) sample(e);
	}
	
	public void sample(Float[] values){
		for (float e:values) sample(e);
	}
	
	public double getAvg(){
		return (sum / (double)num);
	}
	public double getSum(){
		return sum;
	}
	public float getMin(){
		return min;
	}
	public float getMax(){
		return max;
	}
	
	public static void main(String[] args) {
		AuditFlt a = new AuditFlt();
		a.sample(3f);
		a.sample(41f);
		a.sample(5f);
		System.out.println(a.getAvg() + "\t" + a.getMax());
	}
	
}
